package com.cc.pms.controller;


import com.cc.pms.service.ITeamApplicationService;
import com.cc.common.core.domain.R;
import com.cc.pms.domain.Team;
import com.cc.pms.domain.TeamApplication;
import com.cc.pms.service.ITeamService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping
public class TeamController {



    @Resource
    private ITeamApplicationService iTeamApplicationService;

    @Resource
    private ITeamService iTeamService;



    @PostMapping("/team/join/by-invite-code")
    public R<Long> joinTeamByInviteCode(@RequestBody Team team){
        return iTeamService.joinTeamByInviteCode(team);
    }


    @PostMapping("/team/{teamId}/join/private")
    public R<Long> joinPrivateTeam(@PathVariable Long teamId){
       return iTeamService.joinPrivateTeam(teamId);
    }

    @PostMapping("/team/join/encryption")
    public R<Long> joinEncryptionTeam(@RequestBody Team team){
        return iTeamService.joinEncryptionTeam(team);
    }

    @PostMapping("/team/join/public")
    public R<Long> joinPublicTeam(@RequestBody TeamApplication application){
        return iTeamApplicationService.applicationTeam(application);
    }




}
